package recharge

import (
	"gitee.com/liuxuezhan/ar-platform/assets-rpc/internal/dao/schema"
	"gitee.com/liuxuezhan/ar-platform/assets-rpc/rpc"
)

const TableNameRechargeOrder = "recharge_order"

// RechargeOrder 充值订单
type RechargeOrder struct {
	schema.Model
	rpc.Facebook
	UserID          int64   `gorm:"type:bigint;not null;comment:用户id;index"`
	OrderNo         string  `gorm:"type:varchar(64);not null;comment:订单号;index"`
	OrderId         string  `gorm:"type:varchar(64);not null;comment:第三方支付平台订单号;index"`
	Type            int32   `gorm:"type:tinyint;not null;comment:充值类型;index"`
	ChannelID       int64   `gorm:"type:bigint;not null;comment:渠道id;index"`
	Amount          float64 `gorm:"type:decimal(20,4);not null;comment:换算之后bet豆"`
	Ratio           float64 `gorm:"type:decimal(20,4);not null;comment:换算比率"`
	Coin            string  `gorm:"type:varchar(20);not null;comment:币种名称"`
	ReturnJson      string  `gorm:"type:varchar(2048);not null;comment:第三方回调信息"`
	Status          int32   `gorm:"type:tinyint;default:1;not null;comment:1申请中，2成功，3失败，4超时;index"`
	DepositTime     uint32  `gorm:"type:int(10) unsigned;default:0;column:deposit_time;comment:入款到账时间"`
	TransferReceipt string  `gorm:"type:varchar(100);not null;column:transfer_receipt;comment:转账凭证"`
	CustomerInfo    string  `gorm:"type:varchar(100);not null;column:customer_info;comment:客户信息"`
	VipLevel        int32   `gorm:"type:tinyint;default:0;not null;column:vip_level;comment:会员等级"`
	BankUpi         string  `gorm:"type:varchar(100);not null;column:bank_upi;comment:银行卡/upi"`
	ActualAmount    float64 `gorm:"type:decimal(20,4);not null;column:actual_amount;comment:实际充值的币种金额"`
	GoonStatus      int32   `gorm:"type:tinyint;default:2;not null;column:goon_status;comment:1暂停2继续"`
	DepositType     int64   `gorm:"type:bigint;default:1;not null;column:deposit_type;comment:1三方入款2银行卡3入款记录"`
	RefId           int64   `gorm:"type:bigint;column:ref_id;comment:RefID"`
	Domain          string  `gorm:"type:varchar(255);column:domain;comment:C端渠道域名"`
	ExpiredTime     int64   `gorm:"type:bigint(20) unsigned;default:0;column:expired_time;comment:充值超时时间"`
}

func (*RechargeOrder) TableName() string {
	return TableNameRechargeOrder
}

const (
	PendingStatus = 1
	TimeoutStatus = 4
)
